package org.hiucung.orangeappupdater.updater.bean;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

public class DownloadBean implements Serializable {
    public String title;
    public String content;
    public String url;
    public String md5;
    public String versionCode;

    public static DownloadBean parse(String resopnse){

        try {
            JSONObject repJson = new JSONObject(resopnse);
            String title = repJson.optString("title");
            String content = repJson.optString("content");
            String url = repJson.optString("url");
            String md5 = repJson.optString("md5");
            String versionCode = repJson.optString("versionCode");

            DownloadBean downloadBean =  new DownloadBean();
            downloadBean.title = title;
            downloadBean.content = content;
            downloadBean.url = url;
            downloadBean.md5 = md5;
            downloadBean.versionCode = versionCode;

            return downloadBean;

        }catch (JSONException e){
            e.printStackTrace();
        }
        return null;
    }
}
